Ext.define('MyApp.share.MyUtil', {
			xtype : 'myUtil',
			currentRevord : '',
			loadContent : function(records, contentPanel,app) {
				var record = records[0];
				if(record){
					this.currentRevord = record;
					var text = record.get('text'), 
						xtype = record.raw.clazz, 
						treeId = record.get('id'),
						controller = record.raw.controller
						;
					if (record.get('leaf')) { // only leaf nodes have ids
						var className = Ext.ClassManager.getNameByAlias('widget.'+xtype);
						if (className == '') {
							Ext.MessageBoxUtil.msg('提示404', '页面未找到!');
						} else {
							//获取所有的tab项目
							var isHave = false;//判断是否存在 
							var tabItems = contentPanel.items.items;
							for (var i = 0; i < tabItems.length; i++) {
							      if (treeId == tabItems[i].id) {
							            isHave=true;
							            tabItems[i].show();
							      }
							}
							if(!isHave){
									//加载Controller 
								Ext.require(app.name+".controller."+controller, function () {
					                app.getController(controller);
					               
									//添加tab 
									var tab = {
								            title: text,
								            id : treeId,
								            icon: record.get('icon'),
								            layout:'fit',
								            closable : true,
								            cls : 'nav',
								            items: {
										        xtype:xtype
										    }
								     };
								     //判断当前tabId是否已经打开
									contentPanel.add(tab).show();
					           }, this);
							}
						}
					}
				}
			},
			YorNFormat:function(val) {
			        if (val) {
			            return '是';
			        } else{
			            return '否';
			        }
			        return val;
			},
			quartzStatusFormat:function(val) {
			        if (val == '停止') {
			            return '<span style="color:red;">' + val + '</span>';
			        } else if (val == '启动') {
			            return '<span style="color:green;">' + val + '</span>';
			        }if (val == '暂停') {
			            return '<span style="color:orange;">' + val + '</span>';
			        }
			        return val;
			},
			checkAuthority:function(authority){
				var authorities = Ext.user.get('authorities'),hid=true;
					Ext.Array.each(authorities ,function(item, ind, countriesItSelf) {
							if(item.authorityName==authority&&item.navigationid==Ext.myUtil.currentRevord.get('id')){
								hid =  false;
								return false;
							}
					});
				return hid;
			},
			required : '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>'
		});
Ext.myUtil = Ext.create('MyApp.share.MyUtil');